﻿<cfsilent>
	<cfscript>
		
		dictAdvice = getProperty("serviceFactory").getBean("senateDictionaryAdvice");
		mathAdvice = getProperty("serviceFactory").getBean("senateMathAdvice");
		datetimeAdvice = getProperty("serviceFactory").getBean("datetimeAdvice");

		event.setArg("pageTitle", "教学运行管理 - 考试安排 - 课程考试安排");
		
		/* 考试相关设置 */
		finalDateStart = event.getArg("EXAM.FINAL.DateStart");
		finalDateEnd = event.getArg("EXAM.FINAL.DateEnd");
		
		termId = event.getArg("TermID");
		taskType = event.getArg("TT");
		courseId = event.getArg("CID");
		
		taskId = event.getArg("TaskId");
		
		sessionAdvice = getProperty("serviceFactory").getBean("sessionAdvice");

		teacherId = sessionAdvice.getAutherUserID();

		academicYear = event.getArg("AcademicYear");
		academicTerm = event.getArg("AcademicTerm");
		termDateStart = event.getArg("DateStart");

		currentTab = event.getArg("TabID", "labToArrange");

		targetArgs = structNew();
		
		passArgs = structNew();
		structInsert(passArgs, "CID", courseId);
		structInsert(passArgs, "TT", taskType);
		
		passDelArgs = structNew();
		structInsert(passDelArgs, "CID", courseId);
		structInsert(passDelArgs, "TT", taskType);
		
		/*课程信息*/
		sql = "SELECT 
					t_course.course_name, 
					t_institute.institute_name, 
					t_course.period, 
					t_course.period_theory, 
					t_course.course_credit, 
					t_course.cid, 
					t_institute.institute_id 
				FROM  
					t_course 
					INNER JOIN t_institute ON t_institute.institute_id = t_course.institute_id 
				WHERE 
					t_course.cid = :courseId ";
					
		queryObj = new query( datasource=application.dnsSlave );
		queryObj.addParam( name="courseId", value=courseId, cfsqltype="cf_sql_varchar" );
		
		rs_courseEntity = queryObj.execute( sql=sql ).getResult(); 
		
		/*查询考试任务*/
		sql = "SELECT * FROM t_new_examtask WHERE task_id = :taskId";
		
		queryObj = new Query(datasource = application.dnsSlave);
		queryObj.addParam( name="taskId",value=taskId, cfsqltype="cf_sql_varchar");
		
		rs_examTask = queryObj.execute(sql = sql).getResult();	
		
		/*学生冲突查询*/
		sql = "select a.*, c.tch_name, d.course_name, e.classroom 
				from t_new_examtask a 
				INNER JOIN t_task b on b.tsk_id = a.task_id 
				INNER JOIN t_teacher c ON c.tch_id = b.tch_id 
				INNER JOIN t_course d ON d.cid = b.cid 
				INNER JOIN t_classroom e ON e.cr_id = a.cr_id 
				where a.task_id in (
					  SELECT task_id from t_student_course where stu_id in(
						    SELECT stu_id FROM t_student_course where task_id = :taskId 
					  )
				) AND a.date_exam = :dateExam  
				AND a.is_arranged = '3' 
				AND a.task_id != :taskId 
				order by a.time_start ";
		
		queryObj = new Query(datasource = application.dnsSlave);
		queryObj.addParam( name="dateExam",value=rs_examTask.date_exam, cfsqltype="cf_sql_char");
		queryObj.addParam( name="taskId",value=taskId, cfsqltype="cf_sql_varchar");
		
		rs_examStudent = queryObj.execute(sql = sql).getResult();	
		
		/*教师冲突查询（教师是否安排其他考试）*/
		sql = "select a.*, c.tch_name, d.course_name, e.classroom 
				from t_new_examtask a 
				INNER JOIN t_task b on b.tsk_id = a.task_id 
				INNER JOIN t_teacher c ON c.tch_id = b.tch_id 
				INNER JOIN t_course d ON d.cid = b.cid 
				INNER JOIN t_classroom e ON e.cr_id = a.cr_id 
				where b.tch_id = :teacherId AND a.task_id != :taskId 
					 AND a.date_exam = :dateExam  
					AND a.is_arranged = '3' 
				order by a.time_start ";
		
		queryObj = new Query(datasource = application.dnsSlave);
		queryObj.addParam( name="dateExam",value=rs_examTask.date_exam, cfsqltype="cf_sql_char");
		queryObj.addParam( name="taskId",value=taskId, cfsqltype="cf_sql_varchar");
		queryObj.addParam( name="teacherId",value=teacherId, cfsqltype="cf_sql_varchar");
		
		rs_examTeacher = queryObj.execute(sql = sql).getResult();
		
		/*时间冲突查询*/
		sql = "SELECT t_new_examtask.*, t_teacher.tch_name, t_course.course_name FROM t_new_examtask 
			INNER JOIN t_task on t_task.tsk_id = t_new_examtask.task_id 
			INNER JOIN t_teacher ON t_teacher.tch_id = t_task.tch_id 
			INNER JOIN t_course ON t_course.cid = t_task.cid 
			WHERE date_exam = :dateExam AND cr_id = :clsroomId AND task_id != :taskId 
			AND t_new_examtask.is_arranged = '3'
			ORDER BY t_new_examtask.time_start 
			 ";
		
		queryObj = new Query(datasource = application.dnsSlave);
		queryObj.addParam( name="dateExam",value=rs_examTask.date_exam, cfsqltype="cf_sql_char");
		queryObj.addParam( name="clsroomId",value=rs_examTask.cr_id, cfsqltype="cf_sql_char");
		queryObj.addParam( name="taskId",value=taskId, cfsqltype="cf_sql_varchar");
		
		rs_examTime = queryObj.execute(sql = sql).getResult();	
		
		/* 通用教室 */
		sql = "SELECT 
				a.cr_id, a.classroom  
				FROM t_classroom a 
				ORDER BY a.classroom";
				
		queryObj = new Query(datasource = application.dnsSlave);
		rs_clsroom = queryObj.execute(sql = sql).getResult();	
		
		/* 教室 */
		sql = "SELECT 
				a.cr_id, a.classroom  
				FROM t_classroom a 
				WHERE cr_id= :clsroomId 
				ORDER BY a.classroom ";
				
		queryObj = new Query(datasource = application.dnsSlave);
		queryObj.addParam( name="clsroomId",value=rs_examTask.cr_id, cfsqltype="cf_sql_char");
		
		rs_clsroomEntity = queryObj.execute(sql = sql).getResult();	

	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('examTask&TabID=labExamTaskCreate')#</cfoutput>"><i class="mrs img btnList"></i><span class="uiButtonText">考试安排 </span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 campus"></i>课程考试时间地点设置
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix">
			
				<div class="UItab">
					<div class="tabLables">
						<span <cfif currentTab eq "labToArrange">class="active"</cfif> id="labToArrange" tabTarget="ToArrange">课程考试安排</span>
					
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>
				</script>
				
				<div id="ToArrange" class="tabContent">
					
					<div class="noticeBlock">
						<div class="operation">
						</div>
						<h3>《<cfoutput>#rs_courseEntity.course_name#</cfoutput>》 任课单位: <cfoutput>#rs_courseEntity.institute_name#</cfoutput></h3>
						<p><span class="img icon16x16 message"></span>总学时 <em><cfoutput>#rs_courseEntity.period#</cfoutput></em>, 其中理论学时 <em><cfoutput>#rs_courseEntity.period_theory#</cfoutput></em>. 课程总学分:<em><cfoutput>#numberFormat(rs_courseEntity.course_credit, '_.00')#</cfoutput></em> 在<em><cfoutput>#academicYear#</cfoutput>-<cfoutput>#academicTerm#</cfoutput></em>学期</p>
					</div>
					
					
					<div id="taskBox">
				
                         <div class="UIArrangeOper">
                              <b class="lable">教室</b>
                              <div class="content">
                                <cfloop  query="rs_clsroom" >
                                        <cfif rs_examTask.cr_id eq rs_clsroom.cr_id>
                                                       <span class="opBtn OptOn"><cfoutput>#rs_clsroom.classroom#</cfoutput></span>
                                                  <cfelse>
                                                       <a class="opBtn Opt" href="javascript:setClassroom('<cfoutput>#rs_clsroom.cr_id#</cfoutput>');"><cfoutput>#rs_clsroom.classroom#</cfoutput></a>
                                             </cfif>
                                   </cfloop>
                              </div>
                         </div>
                         
                         <div class="UIArrangeOper mbl">
                              <b class="lable">调整</b>
                              <div class="content">
                              
                                        <span>调整日期</span>
                                        <select name="TaskPeriod" id="TaskPeriod" class="filedPeriod">
                                        	<cfif rs_examTask.date_exam eq "">
                                             	<option selected="selected" value="">------无-----</option>
                                             </cfif>
                                        	<cfloop from="#finalDateStart#" to="#finalDateEnd#" index="dateIndex">
                                             
                                             	 <cfif mid(dateIndex,5,2) eq "02">
                                                  	<cfif right(dateIndex,2) gt 29 OR right(dateIndex,2) eq "00">
                                                       
                                                       <cfelse>
                                                       	 <option <cfif rs_examTask.date_exam eq dateIndex>selected="selected"</cfif> value="<cfoutput>#dateIndex#</cfoutput>"><cfoutput>#datetimeAdvice.formatDateString( dateIndex )#</cfoutput></option>
                                                       </cfif>
                                                       
                                                  </cfif>
                                                  
                                             	<cfif mid(dateIndex,5,2) eq "04" OR mid(dateIndex,5,2) eq "06" OR mid(dateIndex,5,2) eq "09" OR mid(dateIndex,5,2) eq "11">
                                                  	<cfif right(dateIndex,2) gt 30 OR right(dateIndex,2) eq "00">
                                                       
                                                       <cfelse>
                                                       	 <option <cfif rs_examTask.date_exam eq dateIndex>selected="selected"</cfif> value="<cfoutput>#dateIndex#</cfoutput>"><cfoutput>#datetimeAdvice.formatDateString( dateIndex )#</cfoutput></option>
                                                       </cfif>
                                                       
                                                  </cfif>
                                                  
                                                  
                                                  <cfif mid(dateIndex,5,2) eq "01" OR mid(dateIndex,5,2) eq "03" OR mid(dateIndex,5,2) eq "05" OR mid(dateIndex,5,2) eq "07" OR mid(dateIndex,5,2) eq "08" OR mid(dateIndex,5,2) eq "10" OR mid(dateIndex,5,2) eq "12" >
                                                  	<cfif right(dateIndex,2) gt 31  OR right(dateIndex,2) eq "00">
                                                       
                                                       <cfelse>
                                                       	 <option <cfif rs_examTask.date_exam eq dateIndex>selected="selected"</cfif> value="<cfoutput>#dateIndex#</cfoutput>"><cfoutput>#datetimeAdvice.formatDateString( dateIndex )#</cfoutput></option>
                                                       </cfif>
                                                       
                                                  </cfif>
                                             	
                                             </cfloop>
                                        </select>
                                      <input id="taskDateTrigger" class="btnSubmit" type="button" value="更新" />
                                        &nbsp;&nbsp;&nbsp;&nbsp;
                          
                              </div>
                         </div>
                         
                          <cfif rs_examtask.recordCount && rs_examtask.cr_id neq "" && rs_examtask.date_exam neq "" >
                              <div class="UIArrangeOper">
                                   <b class="lable">条件</b>
                                   <div class="content">
                                         <span>当前设置日期<font color="#FF0000"><cfoutput> #datetimeAdvice.formatDateString( rs_examTask.date_exam )# </cfoutput></font>在<font color="#FF0000"><cfoutput>#rs_clsroomEntity.classroom# </cfoutput></font>教室考试的其他课程有：</span><br />
                                         <cfif rs_examTime.recordCount >
                                              <table class="UIEditable">
                                                  <thead>
                                                  </thead>
                                                  
                                                  <tbody>
                                                        <cfloop query="rs_examTime">
                                                            <tr class="editRows">
                                                                 <td><cfoutput>#datetimeAdvice.formatTimeString(rs_examTime.time_start, 'HH:MI')#</cfoutput> ~ <cfoutput>#datetimeAdvice.formatTimeString(rs_examTime.time_end, 'HH:MI')#</cfoutput>&nbsp;&nbsp;&nbsp;----&nbsp;&nbsp;&nbsp;<cfoutput>#rs_examTime.course_name#</cfoutput>&nbsp;&nbsp;&nbsp;----&nbsp;&nbsp;&nbsp;<cfoutput>#rs_examTime.tch_name#</cfoutput></td>
                                                            </tr>
                                                       </cfloop>
                                                  </tbody>
                                              
                                              </table>
                                              <cfelse>
                                                  无<br/><br/>
                                          </cfif>
                                        
                                           <span>本班学生在当前设置日期<font color="#FF0000"><cfoutput> #datetimeAdvice.formatDateString( rs_examTask.date_exam )# </cfoutput></font>已有的其他考试课程有：</span><br />
                                           <cfif rs_examStudent.recordCount >
                                                                      
                                                  <cfset sql = "	SELECT COUNT(*) count FROM t_student_course where STU_ID IN (SELECT a.stu_id FROM t_student_course a where a.task_id = :taskTagId) and task_id = :taskId "/>
                                                                  
                                                   <cfset queryObj = new Query(datasource = application.dnsSlave) />
                                                  <cfset queryObj.addParam(name = "taskId", value = rs_examTask.task_id, cfsqltype = "cf_sql_varchar")/>
                                                  <cfset queryObj.addParam(name = "taskTagId", value = rs_examStudent.task_id, cfsqltype = "cf_sql_varchar")/>
                                                  <cfset rs_student = queryObj.execute(sql = sql).getResult() />
                                              <table class="UIEditable">
                                                  <thead>
                                                  </thead>
                                                  
                                                  <tbody>
                                                        <cfloop query="rs_examStudent">
                                                            <tr class="editRows">
                                                                 <td><cfoutput>#datetimeAdvice.formatTimeString(rs_examStudent.time_start, 'HH:MI')#</cfoutput> ~ <cfoutput>#datetimeAdvice.formatTimeString(rs_examStudent.time_end, 'HH:MI')#</cfoutput>&nbsp;&nbsp;&nbsp;----&nbsp;&nbsp;&nbsp;<cfoutput>#rs_examStudent.course_name#</cfoutput>(<font color="#FF0000"><cfoutput>#rs_student.count#</cfoutput></font>)&nbsp;&nbsp;&nbsp;----&nbsp;&nbsp;&nbsp;<cfoutput>#rs_examStudent.tch_name#</cfoutput>&nbsp;&nbsp;&nbsp;----&nbsp;&nbsp;&nbsp;<cfoutput>#rs_examStudent.classroom#</cfoutput></td>
                                                            </tr>
                                                       </cfloop>
                                                  </tbody>
                                              
                                              </table>
                                              <cfelse>
                                                  无<br/><br/>
                                          </cfif>
                                          
                                          <span>当前教师在当前设置日期<font color="#FF0000"><cfoutput> #datetimeAdvice.formatDateString( rs_examTask.date_exam )# </cfoutput></font>已安排的其他考试课程有：</span><br />
                                           <cfif rs_examTeacher.recordCount >
                                                      
                                                  
                                                  <table class="UIEditable">
                                                       <thead>
                                                       </thead>
                                                       
                                                       <tbody>
                                                             <cfloop query="rs_examTeacher">
                                                                 <tr class="editRows">
                                                                      <td><cfoutput>#datetimeAdvice.formatTimeString(rs_examTeacher.time_start, 'HH:MI')#</cfoutput> ~ <cfoutput>#datetimeAdvice.formatTimeString(rs_examTeacher.time_end, 'HH:MI')#</cfoutput>&nbsp;&nbsp;&nbsp;----&nbsp;&nbsp;&nbsp;<cfoutput>#rs_examTeacher.course_name#</cfoutput>&nbsp;&nbsp;&nbsp;----&nbsp;&nbsp;&nbsp;<cfoutput>#rs_examTeacher.tch_name#</cfoutput>&nbsp;&nbsp;&nbsp;----&nbsp;&nbsp;&nbsp;<cfoutput>#rs_examTeacher.classroom#</cfoutput></td>
                                                                 </tr>
                                                            </cfloop>
                                                       </tbody>
                                                   
                                                   </table>
                                              <cfelse>
                                                  无<br/><br/>
                                          </cfif>
                                          
                                   </div>
                              </div>
                              
                              <hr />
                        
                              <form id="formEdit" onSubmit="javascript:return processVerfiyForm('formEdit');" class="formWrapper" method="post" action="<cfoutput>#buildURL('examTimeUpdateDo')#</cfoutput>">
                                   
                                   <input name="taskId" id="taskId" type="hidden" value="<cfoutput>#taskId#</cfoutput>" />
                          
                              
                                   <div class="label">
                                        <span class="req">*</span><b>考试起止时间</b>
                                        <input name="TimeStart" id="TimeStart" type="text" class="typeTime" verification="time" maxlength="5" value="<cfoutput>#datetimeAdvice.formatTimeString(rs_examTask.time_start, 'HH:MI')#</cfoutput>" />
                                        至 
                                        <input name="TimeEnd" id="TimeEnd" type="text" class="typeTime" verification="time" maxlength="5" value="<cfoutput>#datetimeAdvice.formatTimeString(rs_examTask.time_end, 'HH:MI')#</cfoutput>" />
                                   </div> 
                                              
                                   <div class="lable">
                                        <input id="taskSub" class="button" type="button" value="更新" />
                                        <input id="formReset" class="button1" type="reset" value="重设表格" />
                                   </div>
                                   
                              </form>
                              
                             
                        	</cfif>
                         
                                   
                                   
                                   <script language="javascript" type="text/javascript">
								//<![CDATA[
								<!--
								$(document).ready(function() {
									
									$("#TimeStart").mask("99:99");
									$("#TimeEnd").mask("99:99");
								
								});
								
								function checked(){
									var timeStart = $("#TimeStart").val().replace(':','');
									var timeEnd = $("#TimeEnd").val().replace(':','');
									
									var isPassed = true;
									var reason = '';
									
									if( timeStart >= timeEnd){
										isPassed = false;
										reason = '结束时间不能小于或者等于开始时间';
									}else{
										<cfloop query="rs_examTime">
											<cfif rs_examTime.task_id neq rs_examTask.task_id>
											
												<cfset timeStartT = rs_examTime.time_start />
												<cfset timeEndT = rs_examTime.time_end />
												
												if(timeStart >= '<cfoutput>#timeStartT#</cfoutput>' && timeStart < '<cfoutput>#timeEndT#</cfoutput>'){
													isPassed = false;	
													reason = '当前设置时间和已经安排的考试时间段' + '<cfoutput>#datetimeAdvice.formatTimeString(timeStartT, 'HH:MI')#</cfoutput>' + '~' + '<cfoutput>#datetimeAdvice.formatTimeString(timeEndT, 'HH:MI')#</cfoutput>' + '有冲突\n';
												}else if(timeEnd > '<cfoutput>#timeStartT#</cfoutput>' && timeEnd <= '<cfoutput>#timeEndT#</cfoutput>'){
													isPassed = false;	
													reason =reason+ '当前设置时间和已经安排的考试时间段' + '<cfoutput>#datetimeAdvice.formatTimeString(timeStartT, 'HH:MI')#</cfoutput>' + '~' + '<cfoutput>#datetimeAdvice.formatTimeString(timeEndT, 'HH:MI')#</cfoutput>' + '有冲突\n';
												}else if(timeEnd > '<cfoutput>#timeEndT#</cfoutput>' && timeStart < '<cfoutput>#timeStartT#</cfoutput>'){
													isPassed = false;	
													reason = reason+'当前设置时间和已经安排的考试时间段' + '<cfoutput>#datetimeAdvice.formatTimeString(timeStartT, 'HH:MI')#</cfoutput>' + '~' + '<cfoutput>#datetimeAdvice.formatTimeString(timeEndT, 'HH:MI')#</cfoutput>' + '有冲突\n';
												}
												
											</cfif>
											
										</cfloop>
										
										<cfloop query="rs_examStudent">
										
											<cfif rs_examStudent.task_id neq rs_examTask.task_id>
											
												<cfset timeStartS = rs_examStudent.time_start />
												<cfset timeEndS = rs_examStudent.time_end />
												
												if(timeStart >= '<cfoutput>#timeStartS#</cfoutput>' && timeStart < '<cfoutput>#timeEndS#</cfoutput>'){
													isPassed = false;	
													reason = reason+ '当前设置时间和本班学生考试时间段' + '<cfoutput>#datetimeAdvice.formatTimeString(timeStartS, 'HH:MI')#</cfoutput>' + '~' + '<cfoutput>#datetimeAdvice.formatTimeString(timeEndS, 'HH:MI')#</cfoutput>' + '有冲突\n';
												}else if(timeEnd > '<cfoutput>#timeStartS#</cfoutput>' && timeEnd <= '<cfoutput>#timeEndS#</cfoutput>'){
													isPassed = false;	
													reason =reason+ '当前设置时间和本班学生考试时间段' + '<cfoutput>#datetimeAdvice.formatTimeString(timeStartS, 'HH:MI')#</cfoutput>' + '~' + '<cfoutput>#datetimeAdvice.formatTimeString(timeEndS, 'HH:MI')#</cfoutput>' + '有冲突\n';
												}else if(timeEnd > '<cfoutput>#timeEndS#</cfoutput>' && timeStart < '<cfoutput>#timeStartS#</cfoutput>'){
													isPassed = false;	
													reason = reason+'当前设置时间和本班学生考试时间段' + '<cfoutput>#datetimeAdvice.formatTimeString(timeStartS, 'HH:MI')#</cfoutput>' + '~' + '<cfoutput>#datetimeAdvice.formatTimeString(timeEndS, 'HH:MI')#</cfoutput>' + '有冲突\n';
												}
												
											</cfif>
											
										</cfloop>
										
										<cfloop query="rs_examTeacher">
										
											<cfif rs_examTeacher.task_id neq rs_examTask.task_id>
											
												<cfset timeStartS = rs_examTeacher.time_start />
												<cfset timeEndS = rs_examTeacher.time_end />
												
												if(timeStart >= '<cfoutput>#timeStartS#</cfoutput>' && timeStart < '<cfoutput>#timeEndS#</cfoutput>'){
													isPassed = false;	
													reason = reason+ '当前设置时间和 教师监考 时间段' + '<cfoutput>#datetimeAdvice.formatTimeString(timeStartS, 'HH:MI')#</cfoutput>' + '~' + '<cfoutput>#datetimeAdvice.formatTimeString(timeEndS, 'HH:MI')#</cfoutput>' + '有冲突\n';
												}else if(timeEnd > '<cfoutput>#timeStartS#</cfoutput>' && timeEnd <= '<cfoutput>#timeEndS#</cfoutput>'){
													isPassed = false;	
													reason =reason+ '当前设置时间和 教师监考 时间段' + '<cfoutput>#datetimeAdvice.formatTimeString(timeStartS, 'HH:MI')#</cfoutput>' + '~' + '<cfoutput>#datetimeAdvice.formatTimeString(timeEndS, 'HH:MI')#</cfoutput>' + '有冲突\n';
												}else if(timeEnd > '<cfoutput>#timeEndS#</cfoutput>' && timeStart < '<cfoutput>#timeStartS#</cfoutput>'){
													isPassed = false;	
													reason = reason+'当前设置时间和 教师监考 时间段' + '<cfoutput>#datetimeAdvice.formatTimeString(timeStartS, 'HH:MI')#</cfoutput>' + '~' + '<cfoutput>#datetimeAdvice.formatTimeString(timeEndS, 'HH:MI')#</cfoutput>' + '有冲突\n';
												}
												
											</cfif>
											
										</cfloop>
										
									}
									if(isPassed == false){
										alert(reason);
									}else{
										$("#formEdit").submit();
									}
									 
								}
						
								// -->
								//]]>
							</script>
						
					</div>
					
				</div>
                    
                    
			
			</div>
		</li>
	</ul>
</div>


<script language="javascript" type="text/javascript">
	//<![CDATA[
	<!--
	
	
	function setClassroom(clsroomId) {
	
		/* 显示阻挡信息 */
		$.blockUI({ 
					message: '更改教室...',
					css: { 
							'width': '16%',
							'left': '42%',
							'border': 'none', 
							'padding': '15px 5px', 
							'backgroundColor': '#090', 
							'border-radius': '4px', 
							'opacity': .8, 
							'color': '#fff',
							'cursor': null
							},
					overlayCSS: {
							'backgroundColor': '#000', 
							'opacity': .1 ,
							'cursor': null
							}
					}); 
		
		$.post(
		
				"<cfoutput>#buildURL('apiExamSetClassroom')#</cfoutput>", 
				{
					'crid' : clsroomId,
					'tt' : '<cfoutput>#taskType#</cfoutput>',
					'tsk' : '<cfoutput>#taskId#</cfoutput>',
					'seed': (new Date()).getTime()
				}, 
				function(data) {
					
					//$("#out").html(data);

					result = $.parseJSON(data);
										
					/* 刷新排课数据 */
					window.location.reload();
				});
		
	}
	

	function changeDatePriod() {

		var taskPeriod = $("#TaskPeriod").val();

			
			/* 显示阻挡信息 */
			$.blockUI({ 
						message: '更改日期安排...',
						css: { 
								'width': '16%',
								'left': '42%',
								'border': 'none', 
								'padding': '15px 5px', 
								'backgroundColor': '#090', 
								'border-radius': '4px', 
								'opacity': .8, 
								'color': '#fff',
								'cursor': null
								},
						overlayCSS: {
								'backgroundColor': '#000', 
								'opacity': .1 ,
								'cursor': null
								}
						});
				
			$.post(
					"<cfoutput>#buildURL('apiExamDateChange')#</cfoutput>",
					{
						'TSK' : '<cfoutput>#taskId#</cfoutput>',
						'TT' : '<cfoutput>#taskType#</cfoutput>',
						'TP' : taskPeriod,
						'seed': (new Date()).getTime()
					},
					function(data) {
						//$("#out").html(data);
						result = $.parseJSON(data);
	
							/* 刷新排课数据 */
							window.location.reload();
						
							
					});
		
				
	}
			
	
			
	$(document).ready(function() {
				
		/* 绑定事件相应 */

		$("#taskDateTrigger").click(function(){
			changeDatePriod();
		});
		
		$("#taskSub").click(function(){
			checked();
		});
				

	});
	
	// -->
	//]]>
</script>